//
var speed = document.querySelector('.speed')
var bar = document.querySelector('.speed-bar')
var video = document.querySelector('.flex')
// console.log(speed);
speed.addEventListener('mousemove',function(a){
    // console.log(speed.offsetHeight); 
    // console.log(a.pageY);
    var y = a.pageY - speed.offsetTop
    // console.log(y);
    var percent = y/speed.offsetHeight//获取自身高度
    // console.log(percent);
    var height = Math.round(percent*100)+'%'
    var min = 0.5
    var max = 4
    var playbackrate = percent*(max-min)+
    //设置bar高度
    bar.style.height = height
    bar.textContent = playbackrate.toFixed(2)+'x'
    //
    video.playbackRate = playbackrate





})